import os, socket


# 清除dist
os.system('rm -fr dist')
os.system('mkdir dist')


# 修改本地服务ip地址
localname = socket.getfqdn(socket.gethostname())
localhost = socket.gethostbyname(localname)
port = '3000'

httpFilePaty = './src/http/index.js'

lines = []
with open(httpFilePaty, 'r+', encoding='utf-8') as httpFile:
    lines = httpFile.readlines()
    lines[0] = "const baseUrl = 'http://%s:%s'; \n" % (localhost,port);

with open(httpFilePaty, 'w', encoding='utf-8') as httpFile:
    httpFile.writelines(lines)